# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BigQuery.V2.Model.JobConfiguration do
  @moduledoc """


  ## Attributes

  *   `copy` (*type:* `GoogleApi.BigQuery.V2.Model.JobConfigurationTableCopy.t`, *default:* `nil`) - [Pick one] Copies a table.
  *   `dryRun` (*type:* `boolean()`, *default:* `nil`) - Optional. If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
  *   `extract` (*type:* `GoogleApi.BigQuery.V2.Model.JobConfigurationExtract.t`, *default:* `nil`) - [Pick one] Configures an extract job.
  *   `jobTimeoutMs` (*type:* `String.t`, *default:* `nil`) - Optional. Job timeout in milliseconds. If this time limit is exceeded, BigQuery will attempt to stop a longer job, but may not always succeed in canceling it before the job completes. For example, a job that takes more than 60 seconds to complete has a better chance of being stopped than a job that takes 10 seconds to complete.
  *   `jobType` (*type:* `String.t`, *default:* `nil`) - Output only. The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
  *   `labels` (*type:* `map()`, *default:* `nil`) - The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
  *   `load` (*type:* `GoogleApi.BigQuery.V2.Model.JobConfigurationLoad.t`, *default:* `nil`) - [Pick one] Configures a load job.
  *   `query` (*type:* `GoogleApi.BigQuery.V2.Model.JobConfigurationQuery.t`, *default:* `nil`) - [Pick one] Configures a query job.
  *   `reservation` (*type:* `String.t`, *default:* `nil`) - Optional. The reservation that job would use. User can specify a reservation to execute the job. If reservation is not set, reservation is determined based on the rules defined by the reservation assignments. The expected format is `projects/{project}/locations/{location}/reservations/{reservation}`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :copy => GoogleApi.BigQuery.V2.Model.JobConfigurationTableCopy.t() | nil,
          :dryRun => boolean() | nil,
          :extract => GoogleApi.BigQuery.V2.Model.JobConfigurationExtract.t() | nil,
          :jobTimeoutMs => String.t() | nil,
          :jobType => String.t() | nil,
          :labels => map() | nil,
          :load => GoogleApi.BigQuery.V2.Model.JobConfigurationLoad.t() | nil,
          :query => GoogleApi.BigQuery.V2.Model.JobConfigurationQuery.t() | nil,
          :reservation => String.t() | nil
        }

  field(:copy, as: GoogleApi.BigQuery.V2.Model.JobConfigurationTableCopy)
  field(:dryRun)
  field(:extract, as: GoogleApi.BigQuery.V2.Model.JobConfigurationExtract)
  field(:jobTimeoutMs)
  field(:jobType)
  field(:labels, type: :map)
  field(:load, as: GoogleApi.BigQuery.V2.Model.JobConfigurationLoad)
  field(:query, as: GoogleApi.BigQuery.V2.Model.JobConfigurationQuery)
  field(:reservation)
end

defimpl Poison.Decoder, for: GoogleApi.BigQuery.V2.Model.JobConfiguration do
  def decode(value, options) do
    GoogleApi.BigQuery.V2.Model.JobConfiguration.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BigQuery.V2.Model.JobConfiguration do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
